<?php
class ArticleFile {
    
    public function set($data) {
        $dir = ConfigParserLib::get('file', 'article_file_dir') . $data['book_sid'] . '/';
        @mkdir($dir, 0777);
        //为了防止链接被重置，对字符进行编码。如果js有简单加密更好。todo
        file_put_contents($dir . $data['number'] . '.txt', base64_encode(rawurlencode($data['content'])));
        @chmod($dir . $data['number'] . '.txt', 0777);
        return true;
    }
}
?>
